package cn.com.thinvent.dispatch.service.biz.enums;

import java.util.HashMap;
import java.util.Map;

public enum ChineseEnMappingEnums {

    PROJECT_A("project_code", "项目代码"),
    PROJECT_B("project_name", "项目名称"),
    ;

    private static final Map<String, ChineseEnMappingEnums> codeToProjectMap = new HashMap<>();
    private static final Map<String, ChineseEnMappingEnums> valueToProjectMap = new HashMap<>();

    static {
        for (ChineseEnMappingEnums project : ChineseEnMappingEnums.values()) {
            codeToProjectMap.put(project.code, project);
            valueToProjectMap.put(project.value, project);
        }
    }

    private final String code;
    private final String value;

    ChineseEnMappingEnums(String code, String value) {
        this.code = code;
        this.value = value;
    }

    public String getCode() {
        return code;
    }

    public String getValue() {
        return value;
    }

    public static ChineseEnMappingEnums getByCode(String code) {
        return codeToProjectMap.get(code);
    }

    public static ChineseEnMappingEnums getByValue(String value) {
        return valueToProjectMap.get(value);
    }

}
